﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/axios.js"></script>
<script type="text/javascript" src="js/api.js"></script>

</head>

<body style="background:url(images/topbg.gif) repeat-x;">

    <div class="topleft">
    	<a href="main.html" target="_parent"><img src="images/logo.png" title="系统首页"/></a>
    </div>
            
    <div class="topright">
     
    <div class="user">
        <span id="username">管理员</span>
        <i><a href="javascript:void(0)" target="_parent" onclick="logout()">退出</a></i>
        <a href="login.html" target="_parent" id="logout"></a>
    </div>    
    
    </div>

</body>
<script type="text/javascript">
    $("#username").html(localStorage.getItem("username"))
    function logout() {
        let flag = confirm("确定要退出登录吗？");
        if (flag) {
            axiosRequest("get", "/system/permission/logout").then((res)=>{
                if (res.data.code===200) {
                    localStorage.removeItem("uId");
                    localStorage.removeItem("username");
                    localStorage.removeItem("token");
                    document.getElementById("logout").click();
                } else {
                    alert(res.data.message);
                }
            })
        }
    }
</script>
</html>
